local hanta = fk.CreateSkill{
  name = "lingling__hanta",
}

Fk:loadTranslationTable{
  ["lingling__hanta"] = "酣踏",
  [":lingling__hanta"] = "你攻击范围内的角色回合开始时，你可以失去1点体力，视为对其使用【杀】，若未造成伤害，其将一张牌当【酒】使用，"..
  "若造成伤害，你可以将一张牌当【桃】使用。",

  ["#lingling__hanta-invoke"] = "酣踏：你可以失去1点体力，视为对 %dest 使用【杀】",
  ["#lingling__hanta-analeptic"] = "酣踏：请将一张牌当【酒】使用",
  ["#lingling__hanta-peach"] = "酣踏：你可以将一张牌当【桃】使用",
}

hanta:addEffect(fk.TurnStart, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hanta.name) and
      player:inMyAttackRange(target) and player.hp > 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    if room:askToSkillInvoke(player, {
      skill_name = hanta.name,
      prompt = "#lingling__hanta-invoke::"..target.id,
    }) then
      event:setCostData(self, {tos = {target}})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player, 1, hanta.name)
    if target.dead then return end
    local use = room:useVirtualCard("slash", nil, player, target, hanta.name, true)
    if use and use.damageDealt then
      if not player.dead then
        player:drawCards(1, hanta.name)
        if not player.dead then
          room:askToUseVirtualCard(player, {
            name = "peach",
            skill_name = hanta.name,
            prompt = "#lingling__hanta-peach",
            cancelable = true,
            card_filter = {
              n = 1,
            },
          })
        end
      end
    elseif not target.dead then
      room:askToUseVirtualCard(target, {
        name = "analeptic",
        skill_name = hanta.name,
        prompt = "#lingling__hanta-analeptic",
        cancelable = false,
        card_filter = {
          n = 1,
        },
        extra_data = {
          bypass_times = true,
          extraUse = true,
        }
      })
    end
  end,
})

return hanta
